import zipfile
import os
import common.gyblog as log

LOG = log.get_logger()
PATH = '\\\\lcnas\\xishu16t2020_1\choosefc2\\'

files = os.listdir(PATH)
error_list = []
for i, file in enumerate(files):
    name = ''.join(file.split('.')[:-1])
    print("进度：{}%---{}".format(round(i / len(files) * 100, 2), name))
    try:
        zip_file = zipfile.ZipFile(PATH + '\\' + file, 'r')
        zip_file.extractall(PATH + '\\' + name)
        zip_file.close()
    except:
        LOG.error('{}解压失败'.format(name))
        error_list.append(name)
print("解压{}个文件OK".format(len(files)))
print("解压失败的有：")
for j in error_list:
    print(j)
